package com.hc.controller;

import com.hc.bean.Result;
import com.hc.bean.ResultUtil;
import com.hc.mapper.RoleMapper;
import com.hc.security.MyUserDetailService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/role")
public class RoleController {
    @Resource
    private RoleMapper roleMapper;

    @Resource
    private MyUserDetailService myUserDetailService;

    @GetMapping("/v1/delete")
    public Result deleteRoleById(Integer roleId){

        //清空Redis缓存
        myUserDetailService.clearAuthorityByRoleId(roleId);
        return ResultUtil.success(200,"角色删除成功");
    }
}
